package com.boot.cluster;

public class ClusterConfig {

	/**
	 * 当前节点是否为leader
	 **/
	public volatile static boolean isLeader = false;//NOPMD
	/**
	 * tcp端口查询的范围 如7800-7802
	 **/
	public static int scope = 3;
	/***tcp 通信端口号 ***/
	private Integer port = 7800;
	/**** 集群名称 ****/
	private String clustName;

	/**** 配置文件路径 ****/
	private String config = "raft-tcp.xml";

	/*** 当前节点成员唯一id ip+服务端口号 **/
	private String member;

	/***当前节点的ip***/
	private String bindAddr;

	//集群的ip列表,逗号分隔,用于tcpping查找集群成员
	private String clusterMembers;

	public ClusterConfig(String clustName, String member) {
		this.clustName = clustName;
		this.member = member;
	}

	public ClusterConfig(String clustName, String config, String member) {
		this.clustName = clustName;
		this.config = config;
		this.member = member;
	}

	/**
	 * 集群名称
	 *
	 * @return
	 */
	public String getClustName() {
		return this.clustName;
	}

	/**
	 *  集群名称
	 * @param clustName
	 */
	public void setClustName(String clustName) {
		this.clustName = clustName;
	}

	/**
	 * 配置文件路径 类路径
	 * @return
	 */
	public String getConfig() {
		return this.config;
	}

	/**
	 * 配置文件路径 类路径
	 * @param config
	 */
	public void setConfig(String config) {
		this.config = config;
	}


	/**
	 * tcp 通信端口号
	 * @return
	 */
	public String getBindAddr() {
		return this.bindAddr;
	}

	/**
	 * tcp 通信端口号
	 * @param bindAddr
	 */
	public void setBindAddr(String bindAddr) {
		this.bindAddr = bindAddr;
	}
	/*** 当前节点成员唯一id ip+服务端口号
	 * @return
	 *
	 * */
	public String getMember() {
		return this.member;
	}
	/*** 当前节点成员唯一id ip+服务端口号
	 * @param member
	 */
	public void setMember(String member) {
		this.member = member;
	}

	public Integer getPort() {
		return this.port;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

	public String getClusterMembers() {
		return this.clusterMembers;
	}

	public void setClusterMembers(String clusterMembers) {
		this.clusterMembers = clusterMembers;
	}
}
